//
//  CustomBtn.m
//  block不需要使用weakSelf
//
//  Created by chenleping on 2018/12/17.
//  Copyright © 2018年 DSY. All rights reserved.
//

#import "CustomBtn.h"

@interface CustomBtn()

@property (nonatomic, copy) void(^block) (void);

@end

@implementation CustomBtn

- (instancetype)init{
    self = [super init];
    if (self) {
        
    }
    return self;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    if (self.clickBlock) {
        self.clickBlock();
    }
}
- (void)clickBtn:(void (^)(void))block{
    
    // 对block并没有进行强引用
    block();
    self.block = block; // 对block进行了强引用
}

@end
